﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Resto.CostControl.Core.Domain.Model;
using System.ComponentModel.DataAnnotations;

namespace Resto.CostControl.Core.Facade.DishModule.DataTransferObject
{
    /// <summary>
    /// 菜肴
    /// </summary>
    [Serializable]
    public class DishDTO
    {
        #region 构造函数

        public DishDTO() {}

        internal DishDTO(Dish dish)
        {
            this.ID = dish.ID;
            this.Code = dish.Code;
            this.Category = dish.Category;
            this.CookType = dish.CookType;
            this.Cost = dish.Cost;
            this.Name = dish.Name;
            this.Price = dish.Price;
            this.MainMaterialCategory = dish.MainMaterialCategory;
        }

        #endregion

        #region 基本属性

        public string ID { get; set; }

        /// <summary>
        /// 编号
        /// </summary>
        [Display(Name = "编号")]
        public string Code { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [Display(Name = "名称")]
        public string Name { get; set; }

        /// <summary>
        /// 成本
        /// </summary>
        [Display(Name = "成本")]
        public decimal Cost { get; set; }

        /// <summary>
        /// 售价
        /// </summary>
        [Display(Name = "售价")]
        public decimal Price { get; set; }

        /// <summary>
        /// 菜肴分类(字典)
        /// </summary>
        [Display(Name = "菜肴分类")]
        public string Category { get; set; }

        /// <summary>
        /// 烹调方式(字典)
        /// </summary>
        [Display(Name = "烹调方式")]
        public string CookType { get; set; }

        /// <summary>
        /// 主料大类(字典)
        /// </summary>
        [Display(Name = "主料大类")]
        public string MainMaterialCategory { get; set; }

        #endregion

        #region 方法

        internal Dish ToDish()
        {
            Dish dish = new Dish();
            CopyToDish(dish);
            return dish;
        }

        internal void CopyToDish(Dish dish)
        {
            dish.Category = this.Category;
            dish.Code = this.Code;
            dish.CookType = this.CookType;
            dish.Cost = this.Cost;
            dish.Name = this.Name;
            dish.Price = this.Price;
            dish.MainMaterialCategory = this.MainMaterialCategory;
        }

        #endregion
    }
}
